s1=0;
s2=0;
function mysrand(x)
{
	s1=x%32768;
	s2=Math.floor(x/32768)%32768;
}
function myrand()
{
	s1=(s1*2333+23333)%32768;
	s2=(s2*23333+2333)%32768;
	return s1^s2;
}
s_="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_-+=[]\\';/.,{}|:\"<>? ";
s=s_.split("");
y=s_.split("");
sy=new Array();
ys=new Array();
function shuffle()
{
	var n=s.length;
	for(var i=0;i<n;i++)
	{
		t=myrand()%(i+1);
		w=s[t]; s[t]=s[i]; s[i]=w;
	}
	for(var i=0;i<128;i++) sy[i]=ys[i]=i;
	for(var i=0;i<n;i++) sy[s[i].charCodeAt(0)]=y[i].charCodeAt(0);
	for(var i=0;i<n;i++) ys[y[i].charCodeAt(0)]=s[i].charCodeAt(0);
}
function encode(s)
{
	if((s1==0)&&(s2==0)) return s;
	var t=s.split(""),n=s.length;
	for(var i=0;i<n;i++)
	t[i]=String.fromCharCode(sy[t[i].charCodeAt(0)]);
	return "[enc]"+t.join("");
}
function decode(s)
{
	if(s.substr(0,5)!="[enc]") return s;
	s=s.substr(5);
	var t=s.split(""),n=s.length;
	for(var i=0;i<n;i++)
	t[i]=String.fromCharCode(ys[t[i].charCodeAt(0)]);
	return t.join("");
}
mysrand(2333333);
shuffle();
t="hello world!";
console.log(encode(t));
console.log(decode(encode(t)));
